package com.erp.module.kaoShi

import android.content.Intent
import android.view.View
import com.erp.activity.GonggaoTextActivity
import com.erp.mclass.QuanXian
import com.erp.R
import com.erp.myFragment.BaseKFragment
import kotlinx.android.synthetic.main.fragment_kaoshi.*

/**
 * Created by Administrator on 2018/4/11/011.
 * 作者：刘洋
 * 考试
 */
class FragmentKKaoShi : BaseKFragment(), View.OnClickListener {

    private val f = "FragmentKKaoShi"
    override fun getLayoutId(): Int {
        fragmentname=f
        return R.layout.fragment_kaoshi
    }

    override fun initData() {
        if(QuanXian.isZhuanMaiDianKaoShi){
            btZhuanMaiDianKaoShi.setBackgroundResource(R.drawable.button_style1)
            btZhuanMaiDianKaoShi.setOnClickListener(this)
        }else{
            btZhuanMaiDianKaoShi.setBackgroundResource(R.drawable.button_style1_huise)
        }
        if(QuanXian.isYingXiaoZhongXingKaoShi){
            btYingXiaoZhongXingKaoShi.setBackgroundResource(R.drawable.button_style1)
            btYingXiaoZhongXingKaoShi.setOnClickListener(this)
        }else {
            btYingXiaoZhongXingKaoShi.setBackgroundResource(R.drawable.button_style1_huise)
        }
        if(QuanXian.isShengChanZhongXingKaoShi){
            btShengChanZhongXingKaoShi.setBackgroundResource(R.drawable.button_style1)
            btShengChanZhongXingKaoShi.setOnClickListener(this)
        }else{
            btShengChanZhongXingKaoShi.setBackgroundResource(R.drawable.button_style1_huise)
        }
    }
    override fun onClick(v: View?) {
        val intent = Intent(activity, GonggaoTextActivity::class.java)
        intent.putExtra("fangda",true)
        when(v){
            btZhuanMaiDianKaoShi -> {
                intent.putExtra("url","https://erp.knoya.com/txydt" )
                intent.putExtra("title","专卖店考试")
                startActivity(intent)
            }
            btYingXiaoZhongXingKaoShi -> {
                intent.putExtra("url","https://erp.knoya.com/yxzxtk")
                intent.putExtra("title","营销中心考试")
                startActivity(intent)
            }
            btShengChanZhongXingKaoShi -> {
                intent.putExtra("url","https://erp.knoya.com/zstk" )
                intent.putExtra("title","生产中心考试")
                startActivity(intent)
            }
        }
    }
}